package com.lc.activiti.process.controller;


import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.lc.activiti.config.Result;
import com.lc.activiti.process.entity.TaskAuditRecords;
import com.lc.activiti.process.service.TaskAuditRecordsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 流程审核记录(TaskAuditRecords)表控制层
 *
 * @author 骆超
 * @since 2021-06-24 14:29:27
 */
@RestController
@RequestMapping("taskAuditRecords")
@Api(tags = "流程审核记录")
public class TaskAuditRecordsController {
    /**
     * 服务对象
     */
    @Resource
    private TaskAuditRecordsService taskAuditRecordsService;

    /**
     * 根据业务id，获取审核历史
     * @author 骆超
     * @date 2021/6/24
     * @param auditRecords TaskAuditRecords类实例
     * @return com.lc.activiti.config.Result
     */
    @PostMapping("getRecords")
    @ApiOperation(value = "根据业务id，获取审核历史",notes = "根据业务id，获取审核历史")
    public Result getRecords(@RequestBody TaskAuditRecords auditRecords){
        return Result.success(taskAuditRecordsService.list(Wrappers.lambdaQuery(TaskAuditRecords.class).eq(TaskAuditRecords::getBusinessId,auditRecords.getBusinessId()).orderByAsc(TaskAuditRecords::getCreateDate)));
    }

}
